package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.CompanyAccountRequest;
import org.springframework.web.bind.annotation.*;

/**
 * @author: QIK
 * @CreateDate: 2019/5/13 16:15
 */
@RestController
@RequestMapping("crmPc/component")
@Api(description = "小程序管理",tags="小程序管理")
public class ComponentController extends BaseController {

    @ApiOperation(value = "小程序授权")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "appId", value = "需要授权的appid", required = true, paramType = "String"),
            @ApiImplicitParam(name = "accountType", value = "需要授权的appid", required = true, paramType = "String"),
    })
    @PostMapping("componentloginpage")
    @ApiController(isLogin = true,isBoss = true,paramClass =CompanyAccountRequest.class)
    public ResultModel<String> componentloginpage(@RequestAttribute CompanyAccountRequest request){
        return wechatFegin.componentloginpage(request);
    }


    @ApiOperation(value = "授权成功回调")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "authCode", value = "authCode", required = true, paramType = "String"),
    })
    @PostMapping("componentCallBack")
    @ApiController(paramClass =CompanyAccountRequest.class)
    public ResultModel componentCallBack(@RequestAttribute CompanyAccountRequest request){
        return wechatFegin.componentCallBack(request);
    }

    @ApiOperation(value = "获取账号信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "appId", value = "appId", required = true, paramType = "String"),
    })
    @PostMapping("getAuthorizerInfo")
    @ApiController(isLogin = true,isBoss = true,paramClass =CompanyAccountRequest.class)
    public ResultModel getAuthorizerInfo(@RequestAttribute CompanyAccountRequest request){
        return wechatFegin.getAuthorizerInfo(request);
    }
}
